package itheima;

import java.time.LocalDate;
import java.util.ArrayList;

public class LocalDateTest {
    public static void main(String[] args) {
        //获取今天的时间
        LocalDate now=LocalDate.now();
        ArrayList<LocalDate> dates=new ArrayList<>();
        System.out.println("当前时间"+now);
        LocalDate beforeNow=now.minusMonths(-1);
        System.out.println("当前时间前一个月"+beforeNow);

        //
        ArrayList <LocalDate> dates1=new ArrayList<>();
        dates.add(beforeNow);
        while (beforeNow.isBefore(now)){
            //获取下一个月
            beforeNow = beforeNow.plusMonths(1);
            dates.add(beforeNow);
        }
        System.out.println("一个月时间"+dates);

    }
}
